package com.ruslan.magaz.domain;
// default package
// Generated 28.09.2014 13:25:18 by Hibernate Tools 3.4.0.CR1

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * Orderstatus generated by hbm2java
 */
@Entity
@Table(name = "orderstatus", catalog = "eshop")
public class OrderStatus implements java.io.Serializable {

	private int orderStatusId;
	private Order order;
	private OrderStatusName orderStatusName;
	@Size(min=2,max=15,message=	"City must be between 2 and 15 characters long.")
	@Pattern(regexp="(?U)^\\w(\\w|[ \\-'])*\\w$",	message="Illegal format")
	private String place;
	
	private Date statusTime;

	public OrderStatus() {
	}

	public OrderStatus(int orderStatusId, Order order,
			OrderStatusName orderstatusname) {
		this.orderStatusId = orderStatusId;
		this.order = order;
		this.orderStatusName = orderstatusname;
	}

	public OrderStatus(int orderStatusId, Order order,
			OrderStatusName orderstatusname, String place, Date time) {
		this.orderStatusId = orderStatusId;
		this.order = order;
		this.orderStatusName = orderstatusname;
		this.place = place;
		this.statusTime = time;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "OrderStatus_id", unique = true, nullable = false)
	public int getOrderStatusId() {
		return this.orderStatusId;
	}

	public void setOrderStatusId(int orderStatusId) {
		this.orderStatusId = orderStatusId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "Order_id", nullable = false)
	public Order getOrder() {
		return this.order;
	}

	public void setOrder(Order order) {
		this.order = order;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "OrderStatusName_id", nullable = false)
	public OrderStatusName getOrderStatusName() {
		return this.orderStatusName;
	}

	public void setOrderStatusName(OrderStatusName orderStatusName) {
		this.orderStatusName = orderStatusName;
	}

	@Column(name = "Place", length = 100)
	public String getPlace() {
		return this.place;
	}

	public void setPlace(String place) {
		this.place = place;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "StatusTime", length = 19)
	public Date getStatusTime() {
		return this.statusTime;
	}

	public void setStatusTime(Date time) {
		this.statusTime = time;
	}


}
